﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Company/Company.master" Inherits="WebManager.BasePage" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>

<%@ Import Namespace="TalentPools.BLL" %>
<%@ Import Namespace="TalentPools.Model" %>
<script runat="server">

    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        if (IsValid)
        {
            Company_BaseMeans basemean = new Company_BaseMeans();
            basemean.LoginName = session;
            basemean.QyName = txtqyName.Text.Trim();
            basemean.QyName_en = txtqyName_en.Text.Trim();
            basemean.Yyzz = txtqyYyzz.Text.Trim();
            basemean.Qytype = ddlqyType.SelectedValue;
            basemean.Qyhy = ddlIndustry.SelectedValue;
            basemean.Qymoney = txtmoney.Text.Trim();
            basemean.Qyfrdb = txtfrdb.Text.Trim();
            basemean.Qyrscount = rbrs.SelectedValue;
            basemean.Qycltime = txtcltime.Text.Trim();
            basemean.Qyjj = txtjj.Text.Trim();
            basemean.Qylxmobile = txtphone.Text.Trim();
            basemean.Qyaddress = txtaddress.Text.Trim();
            basemean.Qyemail = txtemial.Text.Trim();
            basemean.Qyhttp = txtpage.Text.Trim();
            basemean.Qycz = txtcz.Text.Trim();
            if (new Company_BaseMeansManager().UpdateBasemean(basemean))
            {
                Label2.Text = "修改成功";
            }
            else
            {
                Label2.Text = "修改失败";
            }
        }
    }
    string session;
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsQyLogin())
        {
            JsWindows("cookie已经过期，请重新登录", "../Index.aspx");
            return;
        }
        session = Request.Cookies["qyUser"].Values["name"];
        if (!IsPostBack)
        {
            this.txtcltime.Attributes.Add("ReadOnly", "true");
            CompanyClass.CheckBaseMeanCount(session);
            Bind();
            Company_BaseMeans basemean = new Company_BaseMeansManager().GetBasemeanObj(session);
            txtqyName.Text = basemean.QyName;
            txtqyName_en.Text = basemean.QyName_en;
            txtqyYyzz.Text = basemean.Yyzz;
            ddlqyType.SelectedValue = basemean.Qytype;
            ddlIndustry.SelectedValue = basemean.Qyhy;
            txtmoney.Text = basemean.Qymoney;
            txtfrdb.Text = basemean.Qyfrdb;
            rbrs.SelectedValue = basemean.Qyrscount;
            txtcltime.Text = basemean.Qycltime;
            txtjj.Text = basemean.Qyjj;
            txtphone.Text = basemean.Qylxmobile;
            txtaddress.Text = basemean.Qyaddress;
            txtemial.Text = basemean.Qyemail;
            txtpage.Text = basemean.Qyhttp;
            txtcz.Text = basemean.Qycz;
        }
    }

    private void Bind()
    {
        ddlIndustry.DataSource = new baseConfigManager().getconfigInfo("行业");
        ddlIndustry.DataValueField = "value";
        ddlIndustry.DataTextField = "value";
        ddlIndustry.DataBind();

        ddlqyType.DataSource = new baseConfigManager().getconfigInfo("企业性质");
        ddlqyType.DataValueField = "value";
        ddlqyType.DataTextField = "value";
        ddlqyType.DataBind();
        
    }
</script>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>

    <div>
        <table width='100%' border='0' align='center' cellpadding='2' cellspacing='1' class='border'>
            <tr class='tdbg'>
                <td colspan="2" class="topbg2">
                    <div align="center" class="Glow">
                        <strong>修 改 单 位 基 本 资 料</strong></div>
                </td>
            </tr>
            <tr class='tdbg'>
                <td width="23%" class="tdbg1">
                    <div align="right">
                        <div align="right">
                            <span style="color: #ff0000">*</span>单位名称(中文)：</div>
                    </div>
                </td>
                <td class="tdbg2" style="width: 482px">
                    <asp:TextBox ID="txtqyName" runat="server" MaxLength="30"></asp:TextBox>
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ControlToValidate="txtqyName"
                        ErrorMessage="请输入单位全称"></asp:RequiredFieldValidator>
                </td>
            </tr>
            <tr class='tdbg'>
                <td class="tdbg1">
                    <div align="right">
                        <div align="right">
                            单位名称(英文)：</div>
                    </div>
                </td>
                <td class="tdbg2" style="width: 482px">
                    <asp:TextBox ID="txtqyName_en" runat="server" MaxLength="30"></asp:TextBox>
                </td>
            </tr>
            <tr class='tdbg'>
                <td class="tdbg1">
                    <div align="right">
                        <div align="right">
                            营业执照号码：</div>
                    </div>
                </td>
                <td class="tdbg2" style="width: 482px">
                    <asp:TextBox ID="txtqyYyzz" runat="server" MaxLength="30"></asp:TextBox>
                </td>
            </tr>
            <tr class='tdbg'>
                <td class="tdbg1">
                    <div align="right">
                        <span style="color: #ff0000">*</span>单位性质：</div>
                </td>
                <td class="tdbg2" style="width: 482px">
                    <asp:DropDownList ID="ddlqyType" runat="server">
                    </asp:DropDownList>
                </td>
            </tr>
            <tr class='tdbg'>
                <td class="tdbg1">
                    <div align="right">
                        <div align="right">
                            <span style="color: #ff0000">*</span>所属行业：</div>
                    </div>
                </td>
                <td class="tdbg2" style="width: 482px">
                    <asp:DropDownList ID="ddlIndustry" runat="server">
                    </asp:DropDownList>
                </td>
            </tr>
            <tr class='tdbg'>
                <td class="tdbg1">
                    <div align="right">
                        <div align="right">
                            注册资金：</div>
                    </div>
                </td>
                <td class="tdbg2" style="width: 482px">
                    <asp:TextBox ID="txtmoney" runat="server" MaxLength="5" Width="50px"></asp:TextBox>万元
                </td>
            </tr>
            <tr class='tdbg'>
                <td class="tdbg1">
                    <div align="right">
                        <div align="right">
                            法人代表：</div>
                    </div>
                </td>
                <td class="tdbg2" style="width: 482px">
                    <asp:TextBox ID="txtfrdb" runat="server" MaxLength="10"></asp:TextBox>
                </td>
            </tr>
            <tr class='tdbg'>
                <td class="tdbg1">
                    <div align="right">
                        <div align="right">
                            <span style="color: #ff0000">*</span>员工总数：</div>
                    </div>
                </td>
                <td class="tdbg2" style="width: 482px">
                    <asp:RadioButtonList ID="rbrs" runat="server" RepeatDirection="Horizontal" RepeatLayout="Flow">
                        <asp:ListItem Selected="True">少于50人</asp:ListItem>
                        <asp:ListItem>50-100人</asp:ListItem>
                        <asp:ListItem>100-200人</asp:ListItem>
                        <asp:ListItem>200-500</asp:ListItem>
                        <asp:ListItem>500-1000</asp:ListItem>
                        <asp:ListItem>1000以上</asp:ListItem>
                    </asp:RadioButtonList>
                </td>
            </tr>
            <tr class='tdbg'>
                <td class="tdbg1">
                    <div align="right">
                        <div align="right">
                            成立日期：</div>
                    </div>
                </td>
                <td class="tdbg2" style="width: 482px">
                    <asp:TextBox ID="txtcltime" runat="server" onclick="setday(this)"></asp:TextBox>
                    <asp:CalendarExtender TargetControlID="txtcltime" ID="CalendarExtender1" runat="server">
                    </asp:CalendarExtender>
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server" 
                        ErrorMessage="请输入成立日期" ControlToValidate="txtcltime"></asp:RequiredFieldValidator>
                </td>
            </tr>
            <tr class='tdbg'>
                <td class="tdbg1">
                    <div align="right">
                        <div align="right">
                            单位简单介绍
                            <br />
                            及业务简介：<br />
                        </div>
                    </div>
                </td>
                <td class="tdbg2" style="width: 482px">
                    <asp:TextBox ID="txtjj" runat="server" Height="223px" Width="398px" TextMode="MultiLine"
                        MaxLength="2000"></asp:TextBox>
                </td>
            </tr>
        </table>
        <table width='100%' border='0' align='center' cellpadding='2' cellspacing='1' class='border'>
            <tr class='tdbg'>
                <td colspan="2" class="topbg2">
                    <div align="center" class="Glow">
                        <strong>单位联系方式</strong></div>
                </td>
            </tr>
            <tr class='tdbg'>
                <td class="tdbg1">
                    <div align="right">
                        <div align="right">
                            联系电话：</div>
                    </div>
                </td>
                <td class="tdbg2">
                    <asp:TextBox ID="txtphone" runat="server" MaxLength="20"></asp:TextBox>
                </td>
            </tr>
            <tr class='tdbg'>
                <td class="tdbg1">
                    <div align="right">
                        <span style="color: #ff0000">*</span>电子邮箱：</div>
                </td>
                <td class="tdbg2">
                    <asp:TextBox ID="txtemial" runat="server"></asp:TextBox>
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ErrorMessage="电子邮箱不能为空"
                        ControlToValidate="txtemial"></asp:RequiredFieldValidator>
                    <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" ControlToValidate="txtemial"
                        ErrorMessage="邮箱格式不符" 
                        ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*"></asp:RegularExpressionValidator>
                </td>
            </tr>
            <tr class='tdbg'>
                <td class="tdbg1">
                    <div align="right">
                        传真号码：</div>
                </td>
                <td class="tdbg2">
                    <asp:TextBox ID="txtcz" runat="server" MaxLength="20"></asp:TextBox>
                </td>
            </tr>
            <tr class='tdbg'>
                <td class="tdbg1">
                    <div align="right">
                        单位联系地址：</div>
                </td>
                <td class="tdbg2">
                    <asp:TextBox ID="txtaddress" runat="server" MaxLength="100"></asp:TextBox>
                </td>
            </tr>
            <tr class='tdbg'>
                <td class="tdbg1">
                    <div align="right">
                        单位网址：</div>
                </td>
                <td class="tdbg2">
                    <asp:TextBox ID="txtpage" runat="server" MaxLength="40"></asp:TextBox>
                </td>
            </tr>
        </table>
        <table width="100%" border="0">
            <tr>
                <td>
                    <div align="center">
                        <asp:Button ID="btnSubmit" runat="server" Text="提交" OnClick="btnSubmit_Click" />
                        <label>
                            &nbsp;<input type="reset" name="Submit2" value="重置" />
                            <br />
                            <asp:Label ID="Label2" runat="server" ForeColor="Red"></asp:Label></label></div>
                </td>
            </tr>
        </table>
    </div>
</asp:Content>
